#include <iostream>
#include <string>
#include <unordered_map>
#include <cctype>
#include <stack>

using namespace std;
stack<int> num;
stack<char> op;

void eval()
{
    auto b = num.top();
    num.pop();
    auto a = num.top();
    num.pop();
    auto c = op.top();
    op.pop();
    int ret;
    if (c == '+')
    {
        ret = a + b;
    }
    else if (c == '-')
    {
        ret = a - b;
    }
    else if (c == '*')
    {
        ret = a * b;
    }
    else
    {
        ret = a / b;
    }
    num.push(ret);
}

int main()
{
    string str;
    cin >> str;
    unordered_map<char, int> m = {{'+', 1}, {'-', 1}, {'*', 2}, {'/', 2}};
    for (int i = 0; i < str.size(); ++i)
    {
        if (isdigit(str[i]))
        {
            int x = 0, j = i;
            while (j < str.size() && isdigit(str[j]))
            {
                x = x * 10 + str[j++] - '0';
            }
            i = j - 1;
            num.push(x);
        }
        else if (str[i] == '(')
        {
            op.push(str[i]);
        }
        else if (str[i] == ')')
        {
            while (op.top() != '(')
            {
                eval();
            }
            op.pop();
        }
        else
        {
            while (op.size() && op.top() != '(' && m[op.top()] >= m[str[i]])
            {
                eval();
            }
            op.push(str[i]);
        }
    }

    while (op.size())
    {
        eval();
    }

    printf("%d", num.top());
    return 0;
}